﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;

namespace SalaryChannel.Web
{
    [ServiceContract(Namespace = "")]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class TestService
    {
        [OperationContract]
        public void DoWork()
        {
            // 在此处添加操作实现
            return;
        }

        [OperationContract]
        public List<Test> GetChannelById(int id)
        {
            using(TestDataClassesDataContext context = new TestDataClassesDataContext())
            {
                var query = context.Test.Where(a => a.Id == id);
                if (query.Any())
                {
                    return query.ToList();
                }
                return new List<Test>(); ;
            }
        }
    }
}
